package com.ezBuilder.goesh;

import android.content.Context;
import android.os.PowerManager;

public class AlarmWakeLock {
	private static final String TAG = "AlarmWakeLock";
	private static PowerManager.WakeLock mWakeLock;

	@SuppressWarnings("deprecation")
	public static void wakeLock(Context context) {
		if (mWakeLock != null) {
			return;
		}
		PowerManager pm = (PowerManager) context
				.getSystemService(Context.POWER_SERVICE);

		mWakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
				| PowerManager.ACQUIRE_CAUSES_WAKEUP
				| PowerManager.ON_AFTER_RELEASE, "LODU");
		mWakeLock.acquire();
	}

	public static void releaseWakeLock() {
		if (mWakeLock != null) {
			mWakeLock.release();
			mWakeLock = null;
		}
	}
}
